<?php

namespace App\Http\Controllers;

use App\Models\Menu;
use Illuminate\Http\Request;

class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //$this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        $list = Menu::orderBy("sort")->where('parent_id', 0)->get();
        return view('home', ['nav' => $list]);
    }
    public function sideBarMenu($id)
    {
        $list = Menu::orderBy("sort")->with('allChildren')->where("id", $id)->get();
        return $list;
    }
}
